package day11;

import java.beans.XMLEncoder;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class ProdTest {
    public static void main(String[] args) {
        List<Product> list=new ArrayList<>();
        list.add(new Product("1000","合肥","恰恰瓜子","袋",1000,6.5));
        list.add(new Product("1001","合肥","恰恰爪子","袋",1000,6.5));
        list.add(new Product("1002","合肥","恰恰南瓜子","袋",1000,8.5));
        list.add(new Product("1003","合肥","恰恰饼干","袋",1000,12.5));
        list.add(new Product("1004","合肥","恰恰蜜桔","袋",1000,11.5));

        try {
            XMLEncoder xe=new XMLEncoder(new FileOutputStream("shangpin.xml"));
            xe.writeObject(list);
            xe.close();
        } catch ( Exception e) {
            e.printStackTrace();
        }
    }
}
